package zaplog

import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

// NewZapLogger return a ZAP SugaredLogger.
func NewZapLogger() (*zap.SugaredLogger, error) {
	cfg := zap.NewDevelopmentConfig()
	cfg.EncoderConfig.EncodeTime = zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05") //指定时间格式
	cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder                  //按级别显示不同颜色
	logger, err := cfg.Build()
	return logger.Sugar(), err
}
